# -*- coding: utf-8 -*-
import urllib3
import json
access_token = '24.fd29d6d5fc97b596b20c7affab5a1231.2592000.1539243161.282335-11801640'
http = urllib3.PoolManager()
url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/sentiment_classify?access_token=' + access_token
params = {'text': 'oben别让我失望啊'}
encoded_data = json.dumps(params).encode('GBK')
request = http.request('POST', url, body=encoded_data, headers={'Content-Type': 'application/json'})
# 注意编码格式
result = str(request.data, 'GBK')
print(result)